<%@ Page Title="Donors" Language="C#" MasterPageFile="~/Views/Shared/Main.Master" AutoEventWireup="true" 
	Inherits="System.Web.Mvc.ViewPage<IEnumerable<good1.Core.Donor>>" %>
<%@ Import Namespace="good1.Core" %>
<%@ Import Namespace="good1.Web.Controllers" %>

<asp:Content ContentPlaceHolderID="mainContentPlaceHolder" runat="server">
    <h2>Donors</h2>

    <% if (ViewContext.TempData["message"] != null){ %>
        <p><%= ViewContext.TempData["message"]%></p>
    <% } %>

    <table>
        <thead>
            <tr>
			    <th colspan="3">Action</th>
            </tr>
        </thead>

		<%
		foreach (Donor donor in ViewData.Model) { %>
			<tr>
				<td><%=Html.ActionLink<DonorsController>( c => c.Show( donor.Id ), "Details ") %></td>
				<td><%=Html.ActionLink<DonorsController>( c => c.Edit( donor.Id ), "Edit") %></td>
				<td>
    				<% using (Html.BeginForm<DonorsController>(c => c.Delete(donor.Id))) { %>
                        <%= Html.AntiForgeryToken() %>
    				    <input type="submit" value="Delete" onclick="return confirm('Are you sure?');" />
                    <% } %>
				</td>
			</tr>
		<%} %>
    </table>

    <p><%= Html.ActionLink<DonorsController>(c => c.Create(), "Create New Donor") %></p>
</asp:Content>
